﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StaticPlugin
{
    public class WebParserEx
    {
        WebBrowser browser;
        public WebParserEx(WebBrowser b) { browser = b; }

        public static HtmlElement getTagByClassName(HtmlElement src, string tag, string className)
        {
            if (src == null) return null;
            foreach (HtmlElement e in src.GetElementsByTagName(tag))
            {
                if (e.GetAttribute("className") == className) return e;
            }
            return null;
        }

        public static HtmlElement getTagByName(HtmlElement src, string tag, string name)
        {
            if (src == null) return null;
            foreach (HtmlElement e in src.GetElementsByTagName(tag))
            {
                if (e.GetAttribute("name") == name) return e;
            }
            return null;
        }
    }

}
